home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / mrcry204.zip / MANUAL < prev    next >
Text File  |  1991-03-04  |  39KB  |  1,278 lines

  1.  
  2. Mercury 2.00 manual
  3. ===================
  4.  
  5. (C) Copyright 1990 Roger Schlafly.
  6. All Rights Reserved.
  7.  
  8. Portions of the software (C) Copyright 1987-88 Borland International.
  9. All Rights Reserved.
  10.  
  11.  
  12. Contents
  13. --------
  14.  
  15. 1. Introduction
  16.  Features
  17.  History
  18.  Shareware policy
  19.  Disclaimer
  20.  Files
  21.  Hardware Requirements
  22.  Installation
  23.  
  24. 2. Problems
  25.  Editing
  26.  Numbers
  27.  Operators
  28.  Constants
  29.  
  30. 3. Solving
  31.  Solutions
  32.  Graphs
  33.  Reports
  34.  
  35. 4. Feature Reference
  36.  Functions
  37.  Statements
  38.  Commands
  39.  
  40.  
  41.  
  42. 1. Introduction
  43.  
  44. Introduction
  45. ------------
  46.  
  47. Mercury is a program for solving equations on the IBM PC.  It is
  48. easy to use, interactive, and powerful.  With it, you can
  49.  
  50. * evaluate mathematical expressions.
  51.  
  52. * solve for the roots of an equation.
  53.  
  54. * solve a system of equations.
  55.  
  56. * maximize or minimize a function, with or without constraints.
  57.  
  58. * evaluate derivatives and definite integrals.
  59.  
  60. * plot one or more functions.
  61.  
  62. * print a report or a graph.
  63.  
  64. Mercury has a built-in editor, pull-down menus, online help,
  65. and all the conveniences necessary to make it accessible to
  66. computer novices.
  67.  
  68. For a quick demonstration of Mercury's capabilities, run MERCURY
  69. and then load and solve some of the sample problems (*.EKA).  If
  70. you get stuck, just press the F1 key for help.
  71.  
  72. Mercury is an outgrowth of Eureka, a product of Borland
  73. International of Scotts Valley, California.  When
  74. Borland decided to concentrate on spreadsheet and database
  75. products, Eureka was spun off.  Mercury was
  76. developed from that code base, and is being released in this
  77. form to satisfy customer requests for new versions of Eureka.  It
  78. is labelled version 2.0 because it is similar to what version 2.0 of
  79. Eureka would have been.
  80.  
  81. Eureka was also available on the Apple Macintosh.  No version
  82. of Mercury for the Macintosh is planned at this time.
  83.  
  84. Mercury is available as Shareware.  Shareware is a name for
  85. programs which are distributed freely or at nominal charge, but
  86. which are copyrighted and have restrictions on their usage.
  87.  
  88. Mercury may be copied freely for examination purposes.  Distributors
  89. may charge a nominal fee, provided that they adhere to the conditions in
  90. VENDOR.DOC.  Commercial and institutional use is prohibited
  91. without a registered license.  Such a license may be obtained by
  92. sending $49 to
  93.  
  94.     Real Software
  95.     PO Box 1680
  96.     Soquel, CA  95073
  97.     USA
  98.  
  99.     phone or fax: 408-476-3550
  100.     CompuServe: 76646,323
  101.     Genie: R.Schlafly
  102.     BBS: 408-476-1055
  103.  
  104. Payment may be by check, MasterCard, or Visa.  See REGISTER.DOC
  105. for an order form.
  106.  
  107. Those who register a license will get the latest version of the
  108. software, an installation program, and a printed manual.  They will
  109. be eligible for technical support, and will be on the mailing list
  110. for future information and updates.
  111.  
  112. Site licenses and other special arrangements are available.
  113.  
  114. Comments, bug reports, and suggestions are especially welcome.
  115.  
  116.  
  117. Disclaimer
  118. ----------
  119.  
  120. The author has made his best effort in producing this software, but
  121. hereby disclaims all warranties.  He will not be liable for any damages
  122. exceeding the price paid for the license to use the software.  The
  123. person using the software bears all risk as to the quality and
  124. performance of the software.
  125.  
  126. Mercury is not a Borland product.  Borland will not provide any
  127. technical support.  Eureka is a registered trademark of Borland
  128. International.  Borland copyrights and trademarks are used with
  129. permission.  Mercury is a trademark of the author.
  130.  
  131.  
  132. Files
  133. -----
  134.  
  135. Mercury consists of these files.
  136.  
  137. MERCURY.EXE           main program
  138. MERCURY.HLP           help file
  139. *.BGI                 graphics drivers
  140. *.CHR                 fonts
  141. *.EKA                 sample problems
  142. MANUAL                user manual (this file)
  143. README                quick instructions
  144. REGISTER.DOC          registration form
  145. VENDOR.DOC            vendor information
  146.  
  147. Auxilliary files:
  148.  
  149. *.EKA                 more sample problems
  150. *.BGI                 more graphics drivers
  151. *.BIN                 external functions
  152. *.C                   source to external functions
  153. MATHL.H               tools for making external functions
  154. *.OBJ                 tools for making external functions
  155. *.LIB                 tools for making external functions
  156.  
  157. If you downloaded Mercury from an online service, you may find the
  158. auxilliary files archived separately.  The extra files are not needed
  159. by most people, and are stored separately to save on connect time.
  160. The extra drivers are for uncommon hardware only, and the tools for
  161. making external functions require Borland's Turbo C++.
  162.  
  163. Registered customers also get INST.COM, an installation program
  164. for configurable options.
  165.  
  166.  
  167. Hardware Requirements
  168. ---------------------
  169.  
  170. Mercury requires an IBM PC or clone with at least 640K
  171. of RAM.  About 500K of free RAM is needed.  In addition,
  172. extended memory (EMS memory) is used if present.  If a
  173. math coprocessor is available, it will be used.  A math
  174. coprocessor is recommended for serious number crunchers.
  175.  
  176. Plots require a graphics monitor and a CGA, EGA, VGA, or
  177. Hercules card.
  178.  
  179. You can print reports and graphs on any of the popular
  180. printers.  Select Printer and Model from the Options menu
  181. for the list of supported printers.
  182.  
  183.  
  184. Installation
  185. ------------
  186.  
  187. There are no special installation requirements.  The simplest
  188. procedure is to make a new directory on your hard disk, and to
  189. copy all of the files there.  You may wish to put the Mercury
  190. directory on your path, or to copy some of the files to your
  191. RAM disk.
  192.  
  193. The program INST may be used to change the edit key bindings,
  194. and to make a few other installation choices.  Various other
  195. configuration options are available from within Mercury, and
  196. these may be saved to disk.  See Options, below.
  197.  
  198. Mercury tries to detect automatically what hardware is present,
  199. but there some situations where you may want to override the
  200. detection logic.
  201.  
  202. If you have a CGA monitor, it may or may not have the "snow"
  203. problem.  If so, you may notice random snow on the screen as
  204. characters are written there.  If so, you can eliminate it by
  205. typing
  206.  
  207.     set CGASNOWCHK=Y
  208.  
  209. at the DOS prompt before loading Mercury.  There must not be any spaces
  210. surrounding the equals sign.
  211.  
  212. Mercury automatically detects the math coprocessor, but
  213. occasionally Mercury fails because the chip is defective.  It can
  214. be turned off with
  215.  
  216.     set 87=N
  217.  
  218. at the DOS prompt.
  219.  
  220. Mercury also detects various graphics cards, but some cannot be
  221. detected.  See the SCREEN statement in Chapter 4.
  222.  
  223. If you have a graphics printer, you will want to select it at the
  224. Printer menu.  The graphics card and printer selection can be
  225. saved to the MERCURY.CFG file, and then it will be automatic each
  226. time Mercury is loaded.
  227.  
  228.  
  229. Errors
  230. ------
  231.  
  232. Error messages are pretty much self-explanatory.  If an error is
  233. detected while parsing the problem file, Mercury puts you in the
  234. Edit window with the cursor at the point of the error.  The error
  235. message at the top of the window, and disappears as soon as you
  236. start editing.  Other errors are displayed in a special box which
  237. is placed on the screen.  After you acknowledge the error by
  238. pressing the Escape key, you are put back in the menu system.
  239.  
  240.  
  241. 2. Problems
  242.  
  243. A problem is entered into Mercury by either loading an existing
  244. one from the disk, or by creating a new one in the Edit window.  This
  245. chapter explains how to use the editor, and how to create a problem
  246. for solving.
  247.  
  248.  
  249. Editing
  250. -------
  251.  
  252. Mercury includes a complete text editor for creating and
  253. modifying problem files.  Usage of the editor is similar
  254. to WordStar in nondocument mode, or to
  255. Borland's SideKick.  The problem files are
  256. ordinary ascii files, and can be edited with any other
  257. text editor.
  258.  
  259. You can move the cursor around in the editor with the arrow
  260. keys, Page Up, Page Down, and some other keys listed below.  The
  261. editor has two typing modes, Insert and Overwrite.  In Insert
  262. mode, anything you type is inserted at the cursor position.  In
  263. Overwrite mode, pressing a key replaces the current character
  264. at the cursor position with the new typed character.  Initially,
  265. the editor operates in Insert mode, a default you
  266. can change with the INST program.  To switch modes, press the
  267. Insert key or Ctrl-V.  (Ctrl-V means to hold down the Ctrl key
  268. on your keyboard while you press V.  The V need not be in upper
  269. case.)
  270.  
  271. No Word-Wrap
  272. Unlike a more standard word processing program, the editor does
  273. not have word-wrap.  You must press Enter at the end of each line.
  274.  
  275. AutoIndent
  276. The editor has an autoindent feature that allows subsequent lines
  277. to automatically indent.  If you leave several spaces at the
  278. start of a line, use Ctrl-OI to indent subsequent lines the same
  279. amount.  The command sequence is a toggle, so you need only
  280. press Ctrl-OI again to stop indenting.
  281.  
  282. Zoom
  283. Sometimes you may want to see more than the area covered by the
  284. current window.  You can "zoom" the window, expanding it to the
  285. size of the entire screen, by pressing F5.  To return the window
  286. to its usual size, press F5 again.  For other window commands,
  287. such as moving and resizing a window, see the Window menu, below.
  288.  
  289. Here is a summary of the editing commands.  Many of these
  290. commands can be changed with the INST installation program.
  291.  
  292.   Cursor Movement Commands:
  293.  
  294.   Character left         Ctrl-S or Left arrow
  295.   Character right        Ctrl-D or Right arrow
  296.   Word left              Ctrl-A
  297.   Word right             Ctrl-F
  298.   Line up                Ctrl-E or Up arrow
  299.   Line down              Ctrl-X or Down arrow
  300.   Scroll up              Ctrl-W
  301.   Scroll down            Ctrl-Z
  302.   Page up                Ctrl-R
  303.   Page down              Ctrl-C
  304.   Left of line           Ctrl-QS or Home
  305.   Right of line          Ctrl-QD or End
  306.   Top of screen          Ctrl-QE or Ctrl-Home
  307.   Bottom of screen       Ctrl-QX or Ctrl-End
  308.   Top of file            Ctrl-QR or Ctrl-PgUp
  309.   Bottom of file         Ctrl-QC or Ctrl-PgDn
  310.   Move to block begin    Ctrl-QB
  311.   Move to block end      Ctrl-QK
  312.   Move to previous point Ctrl-QP
  313.   Move to marker 0       Ctrl-Q0
  314.   Move to marker 1       Ctrl-Q1
  315.   Move to marker 2       Ctrl-Q2
  316.   Move to marker 3       Ctrl-Q3
  317.   Set marker 0           Ctrl-K0
  318.   Set marker 1           Ctrl-K1
  319.   Set marker 2           Ctrl-K2
  320.   Set marker 3           Ctrl-K3
  321.  
  322.   Insert & Delete Commands:
  323.  
  324.   Insert mode on/off     Ctrl-V or Ins
  325.   Insert line            Ctrl-N
  326.   Delete line            Ctrl-Y
  327.   Delete to end of line  Ctrl-QY
  328.   Delete character left  Ctrl-H or Backspace
  329.   Delete character       Ctrl-G or Del
  330.   Delete word right      Ctrl-T
  331.  
  332.   Block commands:
  333.  
  334.   Set block begin        Ctrl-KB or F7
  335.   Set block end          Ctrl-KK or F8
  336.   Mark word              Ctrl-KT
  337.   Hide block             Ctrl-KH
  338.   Copy block             Ctrl-KC
  339.   Move block             Ctrl-KV
  340.   Delete block           Ctrl-KY
  341.   Read block             Ctrl-KR
  342.   Write block            Ctrl-KW
  343.   Print block            Ctrl-KP
  344.  
  345.   Miscellaneous Commands:
  346.  
  347.   Quit edit, no save     Ctrl-KD, Ctrl-KQ, or Esc
  348.   Save and edit          Ctrl-KS or F2
  349.   New file               F3
  350.   Tab                    Ctrl-I or Tab
  351.   Tab mode toggle        Ctrl-OT
  352.   Auto indent on/off     Ctrl-OI
  353.   Restore line           Ctrl-QL
  354.   Find                   Ctrl-QF
  355.   Find & replace         Ctrl-QA
  356.   Repeat last find       Ctrl-L
  357.   Control key prefix     Ctrl-P
  358.   Abort operation        Ctrl-U
  359.   Restore error message  Ctrl-QW
  360.  
  361.   Search Options:
  362.  
  363.   B           Backwards search
  364.   G           Global search
  365.   n           n = any number. Search n times
  366.   N           Replace without asking
  367.   U           Ignore upper/lower case
  368.   W           Search for whole words only
  369.   S           Soundex
  370.  
  371.  
  372. Problems
  373. --------
  374.  
  375. A problem is a text (ascii) file consisting of comments,
  376. definitions, equations, and statements.  See the sample
  377. files for examples of problems.
  378.  
  379. Comments are not read by the Mercury solver, and serve
  380. merely for clarity or documentation.  A comment starts
  381. with a semicolon (;) and runs until the end of the line.
  382. Alternatively, comments can be enclosed in curly braces ({})
  383. and may occupy several lines.
  384.  
  385. Definitions may be either variable initializations or function
  386. definitions and are characterized by the := assignment
  387. operator.  If the left-hand-side is a name, it is taken to
  388. be a variable and the right-hand-side is an expression which
  389. evaluates to the initial value for that variable.  Such initial
  390. values can be critical to the iterative solver.  If the
  391. left-hand-side is a function, as in Square(x) := x^2, then the
  392. right-hand-side serves as the definition for that function.  In
  393. this case, Square is then a function of one argument, and
  394. Square(5) = 25.
  395.  
  396. Equations have a mathematical expression on each side of
  397. an equals sign (=).  An equation may also be an inequality
  398. constraint, in which case the equals sign is replaced by
  399. <, <=, >, or >=.
  400.  
  401. Statements are special directives to Mercury.  They are
  402. instructions either to do something other than solve the equations,
  403. or to control the solution process.  The allowed statements
  404. are listed below, and examples are in the problem files.
  405.  
  406.  
  407. Numbers
  408. -------
  409.  
  410. The range of numbers is plus or minus 1e-307 to 1e+307.
  411.  
  412. When using the exact solver, a question mark indicates that the
  413. next digit is uncertain.  For example, 1.23? indicates a number
  414. that might be anything between 1.225 and 1.235, as these are the
  415. numbers which round to 1.23.
  416.  
  417. Imaginary numbers are indicated with the suffix i.  For example,
  418. x = 2 + 3i is the complex number with real part 2 and imaginary
  419. part 3.
  420.  
  421. Percentages may be expressed with the suffix %.  For example, 5.1%
  422. is the same as .051.
  423.  
  424.  
  425. Examples
  426. --------
  427.  
  428. A number of example problem files (*.EKA) are on the program
  429. disk.  Examination of these is strongly recommended, as these
  430. demonstrate most of Mercury's features.  See Chapter 5.
  431.  
  432.  
  433. 3. Solving
  434.  
  435.  
  436. Solving
  437. -------
  438.  
  439. Mercury features three solver technologies.
  440.  
  441. 1. Direct solver.  This method consists of applying the rules of
  442. high school algebra to manipulate the equations until solutions are
  443. obtained for all the variables.  For example,
  444.  
  445.     2 x + 3 y = 8
  446.     4 x + 5 y = 14
  447.  
  448. can be solved directly by rearranging the first equation to
  449. y = (8 - 2 x)/3 and substituting for y in the second equation.
  450.  
  451. See the LEVEL statement for user control over what manipulations
  452. are allowed.
  453.  
  454. 2. Iterative solver.  The most difficult systems of equations cannot
  455. be solved analytically.  The best we can do is find some approximate
  456. solution and then apply some iterative procedure to improve the
  457. accuracy.  In such case it is advisable to provide starting values
  458. for the variables.
  459.  
  460. 3. Exact solver.  Mercury's most innovative feature is its ability
  461. to use exact methods in many cases.
  462.  
  463.  
  464. Solution Window
  465. ---------------
  466.  
  467. When you apply Solve to a problem file, the result is in the
  468. Solution Window.  The window is editable like the Edit window,
  469. and can be scrolled and zoomed for easy viewed.  The contents
  470. can be saved in a report, if that is desired.
  471.  
  472. The solution lists all of the variables, with their final
  473. values.  Usually, the value is just a number, displayed to
  474. however many digits is specified in the DIGITS statements or
  475. menu options.
  476.  
  477. In some cases, a variable was solved directly and symbolically
  478. in terms of other variables.  If such an expression was used
  479. to calculate the value, then the expression is shown.
  480.  
  481. If no value was ever assigned to the variable, then its value
  482. is given as "UNDEFINED" or "NO SOLUTION".  This occurs if the variable is
  483. used only as a dummy variable, such as in a function definition
  484. or as a variable of integration.
  485.  
  486. Occasionally, a variable value will be given as NAN, which
  487. means Not-A-Number.  This means the variable could not be computed
  488. accurately, and only crude bounds were obtained.  For example,
  489. a result "x = NAN(2.1,7.5)" indicates that x may be anything
  490. between 2.1 and 7.5.  Sometimes such imprecise results represent
  491. the best that can be said about an ill-posed problem, but sometimes
  492. it represents a failure on the part of Mercury.  Such results
  493. should be used with caution.
  494.  
  495. When a variable appears to have the value of a simple fraction,
  496. it is noted in the solution.  For example, solving 3 x = 1 gives
  497. x = 0.333333333333333 { 1 / 3 }.  The fraction is reduced, meaning
  498. that the numerator and denominator have no nontrivial factors.  The
  499. logic which recognizes these fractions is particularly effective
  500. with the Exact solver.
  501.  
  502. In some cases, multiple roots for some variable are found.  These
  503. are listed after the list of variable values.
  504.  
  505. If the problem file has a LIST statement, then the list of the
  506. abscissae and ordinate appear in the solution window.
  507.  
  508. The solution always has a list of residuals.  These are extremely
  509. important for assessing the validity and accuracy of a solution.
  510. A residual is a quantity that should be zero if the equation were
  511. solved perfectly.  It is the absolute value of the difference
  512. between the left and right hand sides of the equation.  For
  513. example, solving SIN(x) = .5 might give as a residual
  514.  
  515.    { 1E-16 }  SIN(x)-.5=0
  516.  
  517. The number in braces, 1E-16, is the residual.  It is the absolute
  518. value of SIN(x)-.5 using the solved value of x.  Residuals of this
  519. size are quite common, as internally Mercury calculates to 16-digit
  520. precision, and there is no machine representable x for which SIN(x)
  521. is exactly 0.5.
  522.  
  523. The equation to the right of the braces is often the same as one of
  524. the input equations, but sometimes Mercury rearranges some terms.
  525. It might be a simple rearrangement as above, but it may also the
  526. result of symbolically solving for one of variables and substituting
  527. it into other equations.  In any case, the equations shown with the
  528. residuals are the actual equations used by the solver.  Some control
  529. of the symbolic substitutions is allowed by the LEVEL statement or
  530. the Level option under the Solver menu.
  531.  
  532. Occasionally, you may see variables name T1, T2, ...  These are temporary
  533. variables introduced by Mercury in the course of solving.  Most
  534. commonly, they are used to enforce inequality constraints.
  535. The constraint
  536.  
  537.     EXP(x + y) + y * z <= 10
  538.  
  539. may be replaced with
  540.  
  541.     EXP(x + y) + y * z + T1 = 10
  542.     T1 >= 0
  543.  
  544. The latter has some technical advantages, even though there is an
  545. extra equation and an extra variable.  Values for the extra variable
  546. are not shown.
  547.  
  548. Finally, the solution ends with the largest residual, the method, and
  549. the processor.  The largest residual is simply the maximum of the
  550. previous residuals.  Assuming your problem is not scaled too badly,
  551. then anything less than about 1E-10 should be considered a success.
  552.  
  553. The method is Exact, Direct, or Iterative.  The exact and direct
  554. solvers are more reliable, and Mercury tries them first.  This logic
  555. can be altered with the METHOD statement.  The processor is a 8087,
  556. 80287, 80387, or emulator.
  557.  
  558.  
  559. Reports
  560. -------
  561.  
  562. A report is an unformatted ascii file holding the problem and the
  563. solution.  It can be saved to disk or printed to keep a record of
  564. the solution.  To save to disk, press Go in the Report menu.  (This
  565. menu item doesn't become active until you have solved a problem.)
  566. Normally, the report has the same name as the problem but with the
  567. .EKA suffix replaced with .RPT.  You can use other file names if you
  568. please.
  569.  
  570. Another way to keep a record of problems and solutions is to have
  571. a Log file.  Just turn Capture On in the Report menu.  Then all
  572. problems and solutions will be appended to a log file.
  573.  
  574. The reports and logs are ordinary ascii files, and can be printed.
  575. If you have a Postscript printer, you will have to select a mode
  576. in which it will accept an ascii file, or load a utility for
  577. printing ascii files.  (No such utility is provided with Mercury.)
  578.  
  579.  
  580. Graphics
  581. --------
  582.  
  583. Mercury may be used to generate graphs.  These visually show
  584. the behavior of functions.  A graphics monitor is required.
  585.  
  586. To get a graph, you must first define a function of one variable
  587. in your problem file.  An example from the file BUMPY.EKA is
  588.  
  589.     bumpy(x) := x^2 SIN(x)
  590.  
  591. which defines a function called "bumpy".  The "x" is a dummy variable.
  592. The has values func(0) = 0^2 SIN(0), func(1) = 1^2 SIN(1), etc.  To
  593. graph the function from -15 to +15, use the statements:
  594.  
  595.     PLOT bumpy
  596.     GBOUNDS -15, +15
  597.  
  598. To assimilate this information into the Mercury solver, you must do
  599. a Solve, even though you are not really solving for anything in this
  600. case.  Once the problem has been solved, the View, Print, and Write
  601. commands become available under the Graph menu.  Select View to see
  602. the graph on the screen.
  603.  
  604. If the graph looks a little ragged, perhaps not enough points were
  605. used to plot it.  The default is 30.  Increasing it to 100 will give
  606. a much smoother graph.  This can be done by either adding the
  607. GPOINTS 100 statement to the problem file and solving it again, or
  608. by selecting GPoints from the Graph menu.
  609.  
  610. It is also possible to have "parametric" plots, where both X and
  611. Y are functions of some other independent variable.  Merely use
  612. the XAXIS statement to specify the X function.  The GBOUNDS statement
  613. then refers to the independent variable.
  614.  
  615. These graphs can be printed on graphics printers.  This includes
  616. most printers, except for daisy-wheel printers.  Selecting Print
  617. will print the graph to whatever printer has been selected under
  618. the Options/Printer menu.
  619.  
  620. You can also select Write, which prints the graph to a file.  Such
  621. a file can be sent to a printer at a later time.  The primary
  622. usefulness of this feature is to export the graph in Lotus or
  623. Postscript format, where it can be imported by another program.
  624.  
  625. The various options in the Graph menu are really the defaults, and
  626. are overridden by the corresponding statements in the problem file.
  627. If there are statements in the problem file setting graph options,
  628. then the menu may not accurately reflect the options used to draw
  629. the graph.  Nevertheless, once a graph has been created, these
  630. options can be modified from the graph menu, and then View will
  631. show the revised graph.
  632.  
  633.  
  634. 4. Feature Reference
  635.  
  636. This chapter gives an alphabetical lookup for the Mercury built-in
  637. functions and statements.
  638.  
  639.  
  640. Operators
  641. ---------
  642. +    add.
  643. -    subtract.
  644. *    multiply.  a space may also be used.
  645. /    divide.
  646. ^    power.  Eg, 2^3 = 8.
  647. ~    complex conjugate.
  648. <    less than.
  649. <=    less than.
  650. >    greater than.
  651. >=    greater than.
  652. =    equals.
  653. :=    variable initialization or function definition.
  654. :    equation separator.
  655. %    percent, eg, 17% = .17.
  656.  
  657. These have the usual mathematical precedence rules, with ^ having
  658. higher precedence than * and /, which in turn are higher than + and -.
  659.  
  660.  
  661. Constants
  662. ---------
  663.  
  664. These two constants are built-in.
  665.  
  666. INF    plus infinity
  667. PI    3.1415926535...  You can also use the greek letter by typing Alt-P.
  668.  
  669.  
  670. Functions
  671. ---------
  672.  
  673. Functions take one or more arguments.  The arguments are  separated
  674. by commas and enclosed in parentheses.  Here is a list of the
  675. built-in functions.  Additional functions can be defined within
  676. a problem file.
  677.  
  678. ABS(x)
  679.  
  680. The absolute value of x.  You can also use |x|.
  681.  
  682. ACOS(x)
  683.  
  684. The arc cosine of x, inverse to COS(x).
  685. The result is in radians.
  686.  
  687. ASIN(x)
  688.  
  689. The arc sine of x, inverse to SIN(x).
  690. The result is in radians.
  691.  
  692. ATAN(x)
  693.  
  694. The arc tangent of x, inverse to TAN(x).
  695. The result is in radians.
  696.  
  697. BESSJ(n,x)
  698.  
  699. The Bessel function of the first kind.
  700. The first argument must be an integer.
  701.  
  702. BESSY(n,x)
  703.  
  704. The Bessel function of the second kind, sometimes
  705. also called the Weber function.
  706. The first argument must be an integer.
  707. For each n, it is a solution to Bessel's
  708. differential equation with a singularity at zero.
  709.  
  710. BINOM(n,k)
  711.  
  712. The number of combinations, choosing k of n items.
  713. Given by  n! / (k! (n-k)!).
  714.  
  715. CEIL(x)
  716.  
  717. The smallest integer greater than or equal to x.
  718. Eg, CEIL(4.7) = 5.
  719.  
  720. COS(x)
  721.  
  722. The cosine of x.  The angle x is measured in radians.
  723.  
  724. COSH(x)
  725.  
  726. The hyperbolic cosine of x, (EXP(x) + EXP(-x))/2.
  727.  
  728. CTERM(rate,fv,pv)
  729.  
  730. The number of periods required for a given present
  731. value (pv) to increase to a given future value (fv)
  732. if it grows at the given interest rate.  The function
  733. is compatible with Quattro/Lotus.
  734.  
  735. DERIV(f(x),x)
  736.  
  737. The derivative of the function f(x) with respect to x.
  738. In most cases, the derivative is computed symbolically.
  739.  
  740. DLGAMMA(n,x)
  741.  
  742. The n-th derivative of LOGGAMMA, n = 0,1,2,...
  743.  
  744. ERF(x)
  745.  
  746. The error function of x.  It is related to NCUM(x).
  747.  
  748.          ERF(x) = 2 NCUM(x SQRT(2)) - 1
  749.  
  750. Eg, ERF(-INF) = -1, ERF(0) = 0, ERF(+INF) = +1.
  751.  
  752. ERFC(x)
  753.  
  754. The complementary error function of x.  See ERF and NCUM.
  755.  
  756.           ERFC(x) = 1 - ERF(x)
  757.  
  758. Eg, ERFC(-INF) = +1, ERFC(0) = 0, ERFC(+INF) = -1.
  759.  
  760. EXP(x)
  761.  
  762. The exponential function of x, e^x, e = 2.71828...
  763. It is the inverse to LN(x).
  764.  
  765. FACT(x)
  766.  
  767. x factorial, sometimes written x!.
  768. Eg, FACT(5) = 5*4*3*2*1 = 120.
  769.  
  770. FLOOR(x)
  771.  
  772. The largest integer less than or equal to x.
  773. Eg, FLOOR(4.7) = 4.
  774.  
  775. FRAC(x)
  776.  
  777. The fractional part of x, x - FLOOR(x).
  778. Eg, FRAC(4.7) = 0.7.
  779.  
  780. FV(pmt,rate,nper)
  781.  
  782. The future value of payments (pmt) at the end of nper
  783. periods, assuming the given interest rate.
  784. The function is compatible with Quattro/Lotus.
  785.  
  786. FVAL(rate,nper,pmt,pv)
  787.  
  788. Gives the future value of a financial with a payment
  789. pmt in each of nper periods, with the given present
  790. value pv, and the given interest rate.
  791. The function is compatible with Quattro Pro.
  792. It uses the financial mode specified by the FINANCE
  793. statement to determine whether the payments are at the
  794. end of the period (the default) or the beginning.
  795.  
  796. HYPOT(x,y)
  797.  
  798. The polar coordinate radius corresponding to cartesian
  799. coordinates (x,y).  Eg, HYPOT(3,4) = 5.
  800.  
  801. IFPOS(x,y,z)
  802.  
  803. Gives y if x >= 0, else it gives z.  Eg, IFPOS(-3,6,7) = 7.
  804.  
  805. IM(x)
  806.  
  807. The imaginary part of x.  The COMPLEX option must be in use.
  808.  
  809. INTEG(f(x),x,a,b)
  810.  
  811. INTEG(f(x),x,a,b) gives the numerical integral of f(x) with
  812. respect to x from a to b.  Improper integrals are allowed, so a
  813. can be -INF, b can be +INF, and f can be singular at a or b.  The
  814. approximation method is adaptive and nonlinear, and often is
  815. accurate to 15 digits.
  816.  
  817. INTEG1(f(x),x,a,b)
  818.  
  819. INTEG1 is similar to INTEG, but uses a simpler
  820. strategy.  It is nonadaptive and linear, and may be preferred in
  821. situations where the result is supposed to be a smooth function
  822. of a and b.  INTEG1 is not nearly as accurate as INTEG on
  823. singular functions.
  824.  
  825. LIMIT(f(x),x,a,INF)
  826.  
  827. Estimates the limit of f(x), as x goes from a to infinity.
  828. It uses a numerical method to compute the limit
  829. of f(x), as x goes from a to infinity.  It is an nonlinear
  830. extrapolation based on a fairly small number of terms.  The
  831. limit is only reliable if the function is well-behaved, and
  832. this feature should be used with caution.
  833.  
  834. LN(x)
  835.  
  836. The natural logarithm (base e) of x.
  837. It is the inverse to EXP(x).
  838.  
  839. LOG10(x)
  840.  
  841. The logarithm of x to the base 10.  The inverse is 10^x.
  842.  
  843. LOGGAMMA(x)
  844.  
  845. The logarithm of the gamma function of x.
  846.  
  847. MAX(x,...)
  848.  
  849. The maximum value of the arguments.
  850. Eg, MAX(-10,5,7) = 7.
  851.  
  852. MIN(x,...)
  853.  
  854. The minimum value of the arguments.
  855. Eg, MIN(-10,5,7) = -10.
  856.  
  857. NCUM(x)
  858.  
  859. The normal cumulative probability function.  NCUM(X) is the
  860. probability that a normal random variable is below its mean,
  861. plus X standard deviations.
  862.  
  863. Eg, NCUM(-INF) = 0, NCUM(0) = .5, NCUM(+INF) = 1.
  864.  
  865. PAYMT(rate,nper,pv,fv)
  866.  
  867. Gives the present value of a financial with a payment
  868. pmt in each of nper periods, with the given future
  869. value fv, and the given interest rate.
  870. The function is compatible with Quattro Pro.
  871. It uses the financial mode specified by the FINANCE
  872. statement to determine whether the payments are at the
  873. end of the period (the default) or the beginning.
  874.  
  875. PMT(pv,rate,nper)
  876.  
  877. Gives the amount of the payments required in each of nper
  878. periods to balance the given present value pv and interest rate.
  879. The function is compatible with Quattro/Lotus.
  880.  
  881. POLAR(x,y)
  882.  
  883. The polar coordinate angle corresponding to cartesian (x,y).
  884. Same as the Quattro/Lotus @ATAN2(x,y) or the Fortran/C atan2(y,x).
  885.  
  886. POLY(x,a0,a1,...,an)
  887.  
  888. The polynomial a0 x^n + ... + an.
  889. Eg, the polynomial 2 x^3 - 3 x + 7 can also be written
  890. POLY(x,2,0,-3,7).  The chief advantage of the latter is
  891. notational convenience, and so it can be recognized by the
  892. special polynomial solver.
  893.  
  894. POS(x)
  895.  
  896. The positive part of x, ie, x if positive and 0 if negative.
  897.  
  898. PV(pmt,rate,nper)
  899.  
  900. Gives the present value of nper payments of amount pmt,
  901. using the given interest rate.
  902. The function is compatible with Quattro/Lotus.
  903.  
  904. PVAL(rate,nper,pmt,fv)
  905.  
  906. Gives the present value of a financial with a payment
  907. pmt in each of nper periods, with the given future
  908. value fv, and the given interest rate.
  909. The function is compatible with Quattro Pro.
  910. It uses the financial mode specified by the FINANCE
  911. statement to determine whether the payments are at the
  912. end of the period (the default) or the beginning.
  913.  
  914. RATE(fv,pv,nper)
  915.  
  916. Gives the interest rate required for the present
  917. value (pv) to increase to the future value (fv) in
  918. nper periods.  The function is compatible with Quattro/Lotus.
  919.  
  920. RE(x)
  921.  
  922. The real part of x.  The COMPLEX option must be in use.
  923.  
  924. REM(x,y)
  925.  
  926. The remainder of x divided by y.  Eg, REM(20,3) = 2.
  927.  
  928. SGN(x)
  929.  
  930. Gives +1 if x > 0, -1 if x < 0.
  931.  
  932. SIN(x)
  933.  
  934. The sine of x.  The angle x is measured in radians.
  935.  
  936. SINH(x)
  937.  
  938. The hyperbolic sine of x, (EXP(x) - EXP(-x))/2.
  939.  
  940. SQRT(x)
  941.  
  942. The square root of x.
  943.  
  944. SUM(f(x),x,a,b)
  945.  
  946. The sum of f from a to b,
  947.  
  948.     f(a) + f(a + 1) + ... + f(b)
  949.  
  950. If b = +INF, the limit is estimated as with the LIMIT function.
  951.  
  952. TAN(x)
  953.  
  954. The tangent of x, SIN(x)/COS(x).
  955. The angle x is measured in radians.
  956.  
  957. TANH(x)
  958.  
  959. The hyperbolic tangent of x, SINH(x)/COSH(x).
  960.  
  961. TERM(pmt,rate,fv)
  962.  
  963. The number of periods required for a given payment
  964. stream (pmt) to increase to a given future value (fv)
  965. if it grows at the given interest rate.
  966. The function is compatible with Quattro/Lotus.
  967.  
  968.  
  969. Statements
  970. ----------
  971.  
  972. BOUNDS lower,upper
  973.  
  974. Specify bounds for the domains of the variables.  The default is
  975. BOUNDS -INF,INF.  Some solving time can be saved with the
  976. statement BOUNDS -1e6,1e6 if you are sure that all the relevant
  977. values of your variables are less than a million.
  978.  
  979. CASEFOLD
  980.  
  981. Ignore case in names.  Otherwise, the variable x is different from X.
  982.  
  983. CASESTRICT
  984.  
  985. Using CASESTRICT, with no args, causes built-in functions,
  986. constants, and statements to be upper case only.  Normally such
  987. predefined names are not case sensitive, so SIN(x) is the same as
  988. sin(x).  Using this option reduces the chance of a name conflict.
  989.  
  990. COMPLEX
  991.  
  992. Declares that all the variables are to be considered complex
  993. variables.  Their solutions have a real and imaginary part.
  994. These built-in functions may be used in a complex problem:
  995.  
  996.     ABS, COS, COSH, EXP, IM, LN, RE, SIN, SINH, SQRT,
  997.     SUM, TAN, TANH.
  998.  
  999. DIGITS n
  1000.  
  1001. Display real numbers to n digits of precision.  The default is 18.
  1002.  
  1003. EPSILON x
  1004.  
  1005. Forces numbers very close to zero to be displayed as zero.  Useful
  1006. for showing complex numbers which are actually real.  Default is EPSILON 0.
  1007.  
  1008. EXTERNAL function
  1009.  
  1010. Declares the name to be an externally defined function, to be
  1011. found on the disk in the problem directory with the file name
  1012. function.BIN.  These functions are written in Turbo C++ or TASM,
  1013. and compiled into .BIN files.  See the samples.
  1014.  
  1015. FINANCE type
  1016.  
  1017. Gives the type parameter to the Quattro compatible financial
  1018. functions, PVAL, PAYMT, and FVAL.  The default is
  1019. type = 0, meaning that the payments are at the end of the
  1020. period.  Use type = 1 if the payments are at the beginning.
  1021.  
  1022. GBOUNDS xleft, xright
  1023.  
  1024. The lower (xleft) and upper (xright) bounds for the X-axis in a graph.
  1025.  
  1026. GPOINTS n
  1027.  
  1028. The number of points (function values) used to draw a graph.  The
  1029. default is 30.  If your graph is too ragged, try increasing the
  1030. number of points.
  1031.  
  1032. GSTYLE n
  1033.  
  1034. Allows graph curves to be thick (GSTYLE 0) or thin (GSTYLE 1).
  1035.  
  1036. INCLUDE filename
  1037.  
  1038. The file with the given name is inserted in the problem at
  1039. that point.  The filename must be in quotes, as in INCLUDE "CONST.INC".  The
  1040. default file name extension is .INC.  Include files cannot be nested.
  1041.  
  1042. ITERATIONS n
  1043.  
  1044. The maximum number of iterations used by the iterative solver.  The
  1045. default is 100.
  1046.  
  1047. LEGEND
  1048.  
  1049. Puts a legend on the graph which identifies the function or functions.
  1050. Recommended when plotting more than one function.
  1051.  
  1052. LEVEL n
  1053.  
  1054. Allows user control over what symbolic substitutions are made.
  1055.  
  1056. 0. no symbolic solving
  1057. 1. solve X = constant
  1058. 2. solve X = constant expression
  1059. 3. solve only when X occurs once, no other variables
  1060. 4. solve only when X occurs once, other variables possible
  1061. 5. solve linear equations
  1062. 6. solve squares, using square roots
  1063. 7. solve quadratic equations
  1064. 8. solve powers
  1065.  
  1066. The default is LEVEL 5, solving linear equations but not using
  1067. square roots.  Strictly speaking, the substitutions involving
  1068. roots are not mathematically equivalent, as the substitution must
  1069. arbitrarily choose the positive or negative square root.
  1070.  
  1071. It is sometimes preferable to use LEVEL 0 to turn off all the
  1072. symbolic manipulations.  Then Mercury effectively weights all
  1073. equations equally, and the solution can be considered the solution
  1074. to a least squares problem.
  1075.  
  1076. LIST function
  1077.  
  1078. List one or more functions in the solution window.  Syntax is the
  1079. same as for PLOT.
  1080.  
  1081. MAXIMIZE x
  1082.  
  1083. The variable x is maximized.
  1084.  
  1085. METHOD n
  1086.  
  1087. Specify the solver method, where n = 1, 2, or 3.
  1088.  
  1089. 1. Exact
  1090. 2. Direct
  1091. 3. Iterative
  1092.  
  1093. The default is METHOD 1, the exact solver.  If it fails, the direct
  1094. solver is tried, and it that also fails, the iterative solver is
  1095. tried.
  1096.  
  1097. MINIMIZE x
  1098.  
  1099. The variable x is minimized.
  1100.  
  1101. PENALTY n
  1102.  
  1103. The value of the penalty constant, an arbitrary constant used
  1104. to enforce constraints when the iterative solver is used to
  1105. maximize or minimize a variable.  The default is 30.  Increasing
  1106. it forces the approximate solutions closer to the constraint
  1107. manifold at the cost of making the extremum harder to find.  Readers
  1108. of The Hitchhiker's Guide to the Galaxy suggest using the value 42.
  1109.  
  1110. PLOT function
  1111.  
  1112. Creates a plot of the named function.  To view the graph, select
  1113. Graph from the main menu.  To plot several functions on the same
  1114. graph, list the names separated by commas.  The functions must be
  1115. defined in the problem file, and be functions of one variable.  For
  1116. example, to plot SIN(x) and x^3-x from -5 to +5, use
  1117.  
  1118.     f(x) := SIN(x)
  1119.     g(x) := x^3 - x
  1120.     GBOUNDS -5, +5
  1121.     PLOT f, g
  1122.  
  1123. PRINT
  1124.  
  1125. Same as PRINTFILE "LPT1".  It prints the graph to the DOS device LPT1,
  1126. which is usually a printer on parallel port 1.  The printing can be
  1127. configured to use another port from the Options menu, and the result
  1128. saved to a setup file.
  1129.  
  1130. PRINTFILE filename
  1131.  
  1132. Print the graph to the given file, whose name is in quotes.
  1133.  
  1134. These names have special meaning.
  1135.  
  1136.     "PAR1"    parallel port 1
  1137.     "SER1"    serial port 1
  1138.     "PAR2"    parallel port 2
  1139.     "SER2"    serial port 2
  1140.     "LPT1"    DOS lpt1
  1141.     "LPT2"    DOS lpt2
  1142.     "LPT3"    DOS lpt3
  1143.     "LPT4"    DOS lpt4
  1144.     "EPT"    IBM postscript port
  1145.  
  1146. PROGRESS x
  1147.  
  1148. Show the value of the variable x in the Progress box.  Mercury
  1149. does not solve for all variables at once, so sometimes there
  1150. might be no value for the variable until the end of the solution
  1151. process.  In such cases, the Progress window shows "x = NAN",
  1152. meaning "x is not a number".  
  1153.  
  1154. If no PROGRESS statement is given, the Progress window shows the
  1155. value of the "Residual".  This is the sum of squares of quantities
  1156. which should be zero, and which Mercury is trying to minimize.  The
  1157. smaller the value, the more likely that Mercury is getting close to
  1158. the solution.
  1159.  
  1160. REPORT filename
  1161.  
  1162. Allows naming a report file from within a problem.
  1163.  
  1164. ROOTSIGN n
  1165.  
  1166. When solving an equation like x^2 = a, Mercury may take the square
  1167. root of both sides.  This introduces two roots, +SQRT(a) and
  1168. -SQRT(a), and Mercury does not know which to take.  You can specify
  1169. that you always want the positive root with ROOTSIGN +1, or
  1170. always the negative root with ROOTSIGN -1.  The default is
  1171. ROOTSIGN 0, which leaves Mercury unable to evaluate the square
  1172. root.
  1173.  
  1174. SCREEN n
  1175.  
  1176. Choose a graphics screen.  The default is SCREEN 0, which means
  1177. Mercury automatically tries to detect your graphics hardware.
  1178. Some graphics cards and modes cannot be detected, and must be
  1179. selected with a SCREEN statement.
  1180.  
  1181.     0.    AutoDetect
  1182.     1.    CGA
  1183.     2.    MCGA
  1184.     3.    EGA 64k
  1185.     4.    EGA 256k
  1186.     5.    EGA Mono
  1187.     6.    IBM 8514
  1188.     7.    Hercules
  1189.     8.    ATT 400 line
  1190.     9.    VGA
  1191.     10.    3270 PC
  1192.     11.    Tandy 1000
  1193.     12.    ATI Super VGA
  1194.     13.    Orchid Super VGA
  1195.     14.    Paradise Super VGA
  1196.     15.    Vega Super VGA
  1197.     16.    Compro ABLE II Super VGA
  1198.     17.    SOTA Super VGA
  1199.  
  1200. From the main menu, the graphics screen can be selected with
  1201. Graph/Mode.  Such a selection is ineffective after the first
  1202. graph is drawn, as the graphics has been initialized at that
  1203. point.  We recommend saving the desired graphics mode to the
  1204. MERCURY.CFG configuration file.
  1205.  
  1206. (Note: The drivers for some of these graphics modes is not
  1207. included with some versions of Mercury.  Registered customers
  1208. receive the full set of drivers.)
  1209.  
  1210. SHOW x
  1211.  
  1212. Show specified variables in the specified order.  Other variables
  1213. are not displayed in the solution window.
  1214.  
  1215. SOLVE x
  1216.  
  1217. Instructs Mercury to solve only for the variable x.  By default, it
  1218. solves for all variables named in the problem.
  1219.  
  1220. If SOLVE is given with a polynomial function name, as in
  1221.  
  1222.     SOLVE f
  1223.     f(x) := POLY(x,1,0,0,1)
  1224.  
  1225. then Mercury will apply a special polynomial root finder to get all
  1226. real and complex roots.
  1227.  
  1228. START x
  1229.  
  1230. The starting value for uninitialized variables while using the
  1231. iterative solver.  The default is 1.00.
  1232.  
  1233. TERMS n
  1234.  
  1235. The most number of terms used by the INTEG and LIMIT functions.  The
  1236. default is 50.
  1237.  
  1238. TIME n
  1239.  
  1240. The maximum time allowed for solution.  The default is 200 seconds.
  1241. Same as MAXTIME in Eureka 1.0.
  1242.  
  1243. TITLE label
  1244.  
  1245. Argument is a quoted string, to be used as a graph title.
  1246. Default is no title.
  1247.  
  1248. SUBTITLE label
  1249.  
  1250. Argument is a quoted string, to be used as a graph subtitle.
  1251. Default is no title.
  1252.  
  1253. XLABEL label
  1254.  
  1255. A label for the X-axis of a graph.  The label must be in quotes.
  1256.  
  1257. YLABEL label
  1258.  
  1259. A label for the Y-axis of a graph.  The label must be in quotes.
  1260.  
  1261. XAXIS function
  1262.  
  1263. Specifies that the X-axis be a function instead of an independent
  1264. variable.  The function must be defined elsewhere as a function
  1265. of one variable.  
  1266.  
  1267. The X axis of the graph is a function with the given name.  Useful
  1268. for parametric plots.  Eg, to graph (x,y) = (cos(t),sin(t)) as
  1269. t goes from 0 to 2*PI, use
  1270.  
  1271.     x(t) := cos(t)
  1272.     y(t) := sin(t)
  1273.     GBOUNDS 0, 2 PI
  1274.     XAXIS x
  1275.     PLOT y
  1276.  
  1277.  
  1278.